package hanqi.mangement.Service;

import hanqi.mangement.Mapper.gradeMapper;
import hanqi.mangement.entity.grade;
import hanqi.mangement.entity.gradebro;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class gradeserviceImpl implements gradeservice{
    @Autowired
    private gradeMapper grademapper;
    @Override
    public List<gradebro> listAll() {
        return grademapper.findAllGradesWithNames();
    }

    @Override
    public List<gradebro> getByCourseId(int courseId) {
        return grademapper.findByCourseId(courseId);
    }

    @Override
    public void updateGrade(grade grade) {
        grademapper.updateById(grade);

    }

    @Override
    public List<gradebro> getByRange(double minScore, double maxScore) {
        return grademapper.findByScoreBetween(minScore, maxScore);
    }
}
